//
//  AboGameSDKApi.h
//  EyuGameSDK
//
//  Created by 李长春 on 2022/5/12.
//
//123
#import <Foundation/Foundation.h>
#import "AboAdParams.h"
NS_ASSUME_NONNULL_BEGIN

typedef void (^ApiSuccessBlock)(NSDictionary *successBack);
typedef void (^ApiFailureBlock)(NSError *error);
//广告相关
typedef void (^ApiAdShowBlock)(AboAdParams*adUnit);
typedef void (^ApiAdFinishBlock)(AboAdParams*adUnit);
typedef void (^ApiAdClickBlock)(AboAdParams*adUnit);
typedef void (^ApiAdHideBlock)(AboAdParams*adUnit);
typedef void (^ApiAdFailBlock)(AboAdParams*adUnit,NSError *error);

@interface AboGameSDKApi : NSObject

#pragma mark - 单例 核心类

+(instancetype)SDKManager;

#pragma mark - 启动第三方服务

/// 启动第三方服务
/// @param application application
/// @param launchOptions launchOptions
/// @param setLanguage 设置本地语言 若传nil 则默认获取本机语言
-(void)StartSDKServiceWithOwnApplication:(UIApplication *)application options:(NSDictionary *)launchOptions language:(NSString*_Nullable)setLanguage;


#pragma mark - 初始化SDK配置

/// SDK配置初始化
/// @param eyuSuccess 成功dic
/// @param eyuFail 失败error
-(void)GameSDKServiceInitEyuSuccess:(ApiSuccessBlock)eyuSuccess eyuFail:(ApiFailureBlock)eyuFail;


#pragma mark - 登录
//监听个人中心切换登录方式的通知  kGameForUserSignInOtherAccountKey
//通知回调携带的数据与登录成功返回的数据一致
//游戏内收到通知后，需跳转到游戏登入界面，重新进入游戏
-(void)StartSiginServiceDoneSuccess:(ApiSuccessBlock)eyuSuccess eyuFail:(ApiFailureBlock)eyuFail;


#pragma mark - 查询内购本地价格

/// 返回苹果商品ID与价格相映射的字典
/// @param products 商品ID的数组
/// @param result  stateCode==1 则表示成功 返回数据字典  stateCode==0 表示出现问题 字典为空
-(void)GameGetAppstoreProductsInfo:(NSArray*)products infoCall:(void(^)(int stateCode,NSDictionary *myProducts))result;


#pragma mark - 支付

/// 购买
/// @param roleID 角色id
/// @param roleName 角色名
/// @param roleLevel 角色等级
/// @param serverID 服务器id
/// @param itemID 产品ID
/// @param cpOrderID CP订单号
/// @param notifyUrl 研发配置url  <非必传 无的时候传"">
/// @param cpExt cpext字段
/// @param eyuSuccess 成功dic
/// @param eyuFail 失败error
-(void)AppleInAppPurchaseWithRoleid:(NSString*)roleID rolename:(NSString*)roleName rolelevel:(NSString*)roleLevel serverid:(NSString*)serverID itemid:(NSString*)itemID cpOrderid:(NSString*)cpOrderID notify:(NSString*)notifyUrl cpext:(NSString*)cpExt money:(NSString*)money propName:(NSString*)name Success:(ApiSuccessBlock)eyuSuccess eyuFail:(ApiFailureBlock)eyuFail;


#pragma mark - 个人中心界面

/// 进入个人中心
/// @param roleid 角色ID
/// @param rolename 角色名字
/// @param serverid 服务器ID
-(void)AccountCenterInterfaceWithRoleId:(NSString*)roleid roleName:(NSString*)rolename serverId:(NSString*)serverid;


#pragma mark -  事件上报

/// 事件上报
/// @param eventName 时间名称
/// @param values 事件字典
-(void)GameTrackEvent:(NSString *)eventName withValues:(NSDictionary *)values;


#pragma mark - 联系客服   <登录前需要拉起客服场景时调用>

/// 登录出现问题时，联系客服调用
-(void)GameOpenFAQBeforeLogin;


#pragma mark - FAQ 问题反馈

/// 因需要用户角色信息 所以必须在角色登录后调用
-(void)GameOpenFAQ;


#pragma mark - FAQs 游戏指南

/// 因需要用户角色信息 所以必须在角色登录后调用
-(void)GameOpenFAQs;


#pragma mark - 用户协议地址

/// 用户协议
-(NSString*)GameProtocolUrl;

#pragma mark - 隐私协议地址

/// 隐私政策
-(NSString*)GameProvacyUrl;

#pragma mark - adTag

/// adTag
-(NSString*)GameGetAdtag;


#pragma mark - 加载激励广告

/// 激励广告是否已经准备好
-(BOOL)RewardAdIsLoaded;

/// 加载激励广告
/// @param adShow 成功拉取广告并开始播放
/// @param adFinish 广告播放完成
/// @param userClick 用户点击广告
/// @param loadFail 广告加载失败
-(void)GameLoadRewardAdWithShow:(ApiAdShowBlock)adShow LookFinish:(ApiAdFinishBlock)adFinish userClick:(ApiAdClickBlock)userClick adLoadFail:(ApiAdFailBlock)loadFail;


#pragma mark - 加载插屏广告

/// 插屏广告是否已经准备好
-(BOOL)InterstitialAdIsLoaded;

/// 加载插屏广告
/// @param adShow 成功拉取广告并开始播放
/// @param adHide 广告移除
/// @param userClick 用户点击广告
/// @param loadFail 广告加载失败
-(void)GameLoadInterstitialAdWithShow:(ApiAdShowBlock)adShow hide:(ApiAdHideBlock)adHide userClick:(ApiAdClickBlock)userClick adLoadFail:(ApiAdFailBlock)loadFail;


#pragma mark - 加载横幅广告

/// 加载横幅广告
/// @param frame 位置 一般 iPhone 和 iPad 上的横幅高度分别为 50 和 90
/// @param bgColor 背景色
/// @param expandAd 点击放大广告
/// @param collapseAd 广告缩小 恢复原样
-(void)GameLoadBannerAdWithFrame:(CGRect)frame backColor:(UIColor*)bgColor expand:(ApiAdClickBlock)expandAd collapse:(ApiAdClickBlock)collapseAd;


#pragma mark --- 移除横幅广告

/// 移除横幅广告
-(void)GameRemoveBannerView;


#pragma mark - 生命周期函数

-(void)applicationDidBecomeActive:(UIApplication *)application;
-(BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options;
-(BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler;

#pragma mark --- 分享

/// 分享Facebook
/// @param isLink YES 表示分享链接  NO表示分享图片
/// @param content 分享内容描述
/// @param photos 一些图片 无图时传入nil
/// @param roleInfo 角色相关信息 role_id、role_name、server_id、server_name、role_level、vip_level
-(void)GameShareLinkWithType:(BOOL)isLink content:(NSString*_Nullable)content photo:(NSArray<UIImage*>*_Nullable)photos roleInfo:(NSDictionary*)roleInfo;


/// 苹果系统分享
/// @param content 分享内容描述
/// @param image 分享的图片   <content和image可二选一，也可同时存在，无内容时就传入nil>
/// @param roleInfo 角色相关信息 role_id、role_name、server_id、server_name、role_level、vip_level
-(void)GameiOSShare:(NSString*_Nullable)content image:(UIImage*_Nullable)image roleInfo:(NSDictionary*)roleInfo;


#pragma mark - 注销用户
-(void)LogoutAccountSuccess:(ApiSuccessBlock)eyuSuccess eyuFail:(ApiFailureBlock)eyuFail;

@end

NS_ASSUME_NONNULL_END
